home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / DELPHI32 / TOOLBARS / RHTRACK / RHTRACK.PAS next >
Pascal/Delphi Source File  |  1996-03-14  |  1KB  |  72 lines

  1. { This is a replacement for the TTrackBar component that supports a
  2.   track bar with or without range selection.
  3.  
  4.   Set EnableRange to True/False to toggle the display of the range
  5.   selection bar on and off.
  6.  
  7.   Component written by:
  8.    Richard Hansen
  9.    Artemis Alliance, Inc.
  10.    289 E 5th St. #211
  11.    St. Paul, MN 55101
  12.  
  13.    (612) 227-7172
  14.    71042.2142@compuserve.com
  15.  
  16.    Delphi design, consulting and development.
  17.  
  18. }
  19. unit RHTrack;
  20.  
  21. interface
  22.  
  23. uses
  24.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  25.   ComCtrls, CommCtrl;
  26.  
  27. type
  28.   TrhTrackBar = class(TTrackBar)
  29.   private
  30.     FEnableRange : Boolean;
  31.  
  32.     procedure SetEnableRange(AState : Boolean);
  33.  
  34.   public
  35.     procedure CreateParams(var Params: TCreateParams); override;
  36.  
  37.   published
  38.     property EnableRange: Boolean read FEnableRange write SetEnableRange;
  39.   end;
  40.  
  41. procedure Register;
  42.  
  43. implementation
  44.  
  45.  
  46. procedure TrhTrackBar.CreateParams(var Params: TCreateParams);
  47. begin
  48.   inherited CreateParams(Params);
  49.  
  50.   if FEnableRange then
  51.     Params.Style := Params.Style or TBS_ENABLESELRANGE
  52.   else
  53.     Params.Style := Params.Style and not TBS_ENABLESELRANGE;
  54. end;
  55.  
  56. procedure TrhTrackBar.SetEnableRange(AState : Boolean);
  57. begin
  58.   if (FEnableRange <> AState) then begin
  59.     FEnableRange := AState;
  60.     RecreateWnd;
  61.   end;
  62. end;
  63.  
  64.  
  65. procedure Register;
  66. begin
  67.   RegisterComponents('Samples', [TrhTrackBar]);
  68. end;
  69.  
  70. end.
  71.  
  72.